import Router from 'vue-router'
Vue.use(Router)


// 解决编程式路由往同一地址跳转时会报错的情况
const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;

// push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch(err => err);
};

//replace
Router.prototype.replace = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalReplace.call(this, location, onResolve, onReject);
  return originalReplace.call(this, location).catch(err => err);
};


export default new Router({
	mode: 'history',
	base: '/pc',

	routes: [
    {
      path: '/',
      redirect:'/index'
    },

    {
        path: '/index',
        component: () => import('@/bisai/index'),
        mete:{
          title:"首页",
        }
    },
    {
        path: '/zhuce',
        component: () => import('@/bisai/zhuce'),
        mete:{
          title:"注册",
        }
    },
    {
        path: '/denglu',
        component: () => import('@/bisai/denglu'),
        mete:{
          title:"登录",
        }
    },
    {
        path: '/zhaohuimima',
        component: () => import('@/bisai/denglu/zhaohuimima'),
        mete:{
          title:"找回密码",
        }
    },
    {
        path: '/chongzhimima',
        component: () => import('@/bisai/denglu/chongzhimima'),
        mete:{
          title:"重置密码",
        }
    },


    {
    	path: '/xinwen',
      component: () => import('@/bisai/xinwen/index'),
      redirect:'/xinwen/xinwen',
      children:[
        {
          path: '/xinwen/xinwen',
          component: () => import('@/bisai/xinwen/list'),
          mete:{
            title:"新闻列表",
          },
        },
        {
          path: '/xinwen/detail',
          component: () => import('@/bisai/xinwen/detail'),
          mete:{
            title:"新闻详情",
          },
        }
      ]
    },

    {
    	path: '/huigu',
      component: () => import('@/bisai/huigu/index'),
      redirect:'/huigu',
      children:[
        {
          path: '/huigu',
          component: () => import('@/bisai/huigu/list'),
          mete:{
            title:"赛事回顾列表",
          },
        },
        {
          path: '/huigu/detail',
          component: () => import('@/bisai/huigu/detail'),
          mete:{
            title:"赛事回顾详情",
          },
        }
      ]
    },

    {
    	path: '/guanyuwomen',
      component: () => import('@/bisai/guanyuwomen/index'),
      redirect:'/guanyuwomen',
      children:[
        {
          path: '/guanyuwomen',
          component: () => import('@/bisai/guanyuwomen/list'),
          mete:{
            title:"关于我们",
          },
        },

      ]
    },
    {
    	path: '/saishijieshao',
      component: () => import('@/bisai/saishijieshao/index'),
      redirect:'/saishijieshao',
      children:[
        {
          path: '/saishijieshao',
          component: () => import('@/bisai/saishijieshao/list'),
          mete:{
            title:"赛事介绍",
          },
        },
        {
          path: '/saishijieshao/detail',
          component: () => import('@/bisai/saishijieshao/detail'),
          mete:{
            title:"赛事详情"
          },
        },
        {
          path: '/saishijieshao/chengji',
          component: () => import('@/bisai/saishijieshao/chengji'),
          mete:{
            title:"赛事成绩",
          },
        }
      ]
    },
    {
    	path: '/baoming',
      component: () => import('@/bisai/baoming/index'),
      redirect:'/baoming',
      children:[
        {
          path: '/baoming',
          component: () => import('@/bisai/baoming/list'),
          mete:{
            title:"报名查询",
          },
        }
      ]
    },
    {
    	path: '/fenxiao',
      component: () => import('@/bisai/fenxiao/index'),
      redirect:'/fenxiao',
      children:[
        {
          path: '/fenxiao',
          component: () => import('@/bisai/fenxiao/list'),
          mete:{
            title:"分销查询",
          },
        }
      ]
    },
    {
    	path: '/xiazai',
      component: () => import('@/bisai/xiazai/index'),
      redirect:'/xiazai',
      children:[
        {
          path: '/xiazai',
          component: () => import('@/bisai/xiazai/list'),
          mete:{
            title:"下载文档",
          },
        }

      ]
    },

	]
})
